package com.neuedu.weishi.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.neuedu.weishi.entity.Video;
import com.neuedu.weishi.mapper.VideoMapper;
import com.neuedu.weishi.service.IVideoService;
import com.neuedu.weishi.vo.PageData;
import org.springframework.stereotype.Service;

@Service("videoService")
public class VideoServiceImpl extends ServiceImpl<VideoMapper, Video> implements IVideoService {

    @Override
    public PageData<Video> selectPageList(int current, int size, String keyword, Video video) {
        PageData<Video> pageData = new PageData<>();
        pageData.setCurrent(current);
        pageData.setSize(size);
        if (video == null) {
            video = new Video();
        }
        if (video.getReviewStatus() == null) {
            //默认查询审核通过的视频
            video.setReviewStatus(2);
        }
        //默认查询正常的视频,即发布中的视频
        video.setVideoStatus(2);
        return getBaseMapper().selectPageList(keyword, video, pageData);
    }
}